import { ExtUUidTuple } from "~/db.pg";
import { PutDto, PutRes, RestDto } from "~/rest";
import { ExtOrder } from "~/extend";

import { ExtOwner } from "@/stream-user/core.define";

import { PaymentWeChatMpGateway } from "./dto.wxmp";
import { PaymentWeChatMp } from "./schema.wxmp";

export const PaymentWxmpRpcGetPath = `${PaymentWeChatMpGateway.path}/get`;
export type getPaymentWxmpRpcDto = { ids: ExtUUidTuple["uuid32"][] };

export const PaymentWxmpRpcPutPath = `${PaymentWeChatMpGateway.path}/put`;
export type putPaymentWxmpRpcDto = PutDto<ExtUUidTuple & ExtOwner & ExtOrder> & { desc: string };

export interface PaymentWxmpRpcInterface<T> {
  /** 在服务端为订单批量查询并拼接支付明细 */
  get(dto: T & getPaymentWxmpRpcDto): Promise<{ entities: PaymentWeChatMp[] }>;

  /** 创建远程支付 */
  put(dto: T & putPaymentWxmpRpcDto): Promise<PutRes<PaymentWeChatMp>>;
}
